package com.tistory.admin.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.xpath.XPath;
import org.jdom.JDOMException; 

import com.omp.commons.utils.DateUtil;
import com.tistory.admin.common.CryptoUtil;
import com.tistory.admin.common.log.OmpLogger;

/**<pre>
 *Description : 휴대폰 등록 ACTION
 *@author KIM JI HUN
 *date : 2009.03.23
 *update history
 *-------------------------------------------------
 *</pre> 
 * 
 */
public class IDPAdapter{

    private static final String SP_ASSOC_KEY = "6b0cc48e477f066b7ef353a4f9e8b756";
    
    private String baseURL = "idp.innoace.com";
    private String spId = "OMP10000";
    
    public IDPAdapter(){
       
    }
    
    private String toHex(byte hash[]) {
        StringBuffer buf = new StringBuffer(hash.length * 2);
        
        for (int i=0; i<hash.length; i++){
            int intVal = hash[i] & 0xff;            
            if (intVal < 0x10){
                // append a zero before a one digit hex
                // number to make it two digits.
                buf.append("0");
            }
            buf.append(Integer.toHexString(intVal));
        }
        return buf.toString();
    }
    
    /**
     * SP_AUTH_KEY 작성시 호출해야할 Mac 생성 API
     * 
     */
    public String generateMacSignature(String key, String message) throws Exception{
        SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
            
        Mac mac = Mac.getInstance("HmacSHA1");
        mac.init(skeySpec);
           
        byte[] result = mac.doFinal(message.getBytes());

        return toHex(result);
    }    
    
    
    private HashMap<String, String> executeParse(Document  doc) {
        HashMap<String, String> hm = new HashMap<String, String>();
        
        List<Element> nodes = doc.getRootElement().getChild("responseHeader").getChildren();
        List<Element> bodyNodes = doc.getRootElement().getChild("responseBody").getChildren();
        for(int i = 0; i < nodes.size(); i++) {
            Element el = (Element)nodes.get(i);

            hm.put(el.getName(), el.getValue());
        }
        for(int i = 0; i < bodyNodes.size(); i++) {
            Element el = (Element)bodyNodes.get(i);

            hm.put(el.getName(), el.getValue());
        }        
        
        return hm;
    }    

    
//////////////////// TEST CONNECTION ////////////////    
    public HashMap testConnection(){
        
        URL url;//URL 주소 객체
        URLConnection connection;//URL접속을 가지는 객체
        InputStream is;//URL접속에서 내용을 읽기위한 Stream
        InputStreamReader isr;
        BufferedReader br;
        
        String connectionResult = "";
        int resultStrLength = 0;
        String cmd = "";
        String result = "";
        String result_text = "";
        String join_type = "";
        
        HashMap resultMap = new HashMap();

        try{
            //URL객체를 생성하고 해당 URL로 접속한다..
            url = new URL("http://naver.com");
            connection = url.openConnection();
            
            System.out.println("getURL == ["+connection.getURL()+"]");
            System.out.println("getURL == ["+connection.getContent()+"]");
            System.out.println("httpResponseCode == ["+((HttpURLConnection)connection).getResponseCode()+"]");
            System.out.println("httpResponseMessage == ["+((HttpURLConnection)connection).getResponseMessage()+"]");
            System.out.println("CONTENT == ["+((HttpURLConnection)connection).getContent()+"]");
            
            //내용을 읽어오기위한 InputStream객체를 생성한다..
            is = connection.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);

            //내용을 읽어서 화면에 출력한다..
            String buf = null;
            while(true){
                buf = br.readLine();
                if(buf == null) break;
//                System.out.println(buf);
                connectionResult += buf.toString();
            } 
            
            System.out.println("connectionResult == ["+connectionResult+"]");
                 
//            connectionResult += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
//            connectionResult += "<idpResponse><responseHeader>\n";
//            connectionResult += "<cmd>mobileAuthcodeSend</cmd>\n";
//            connectionResult += "<result>1000</result>\n";
//            connectionResult += "<result_text>Success</result_text>\n";
//            connectionResult += "<join_type>2</join_type>\n";
//            connectionResult += "</responseHeader>\n";
//            connectionResult += "<responseBody>\n";
//            connectionResult += "<mobile_sign>xxxx</mobile_sign>\n";
//            connectionResult += "<sign_data >xxxx</sign_data>\n";
//            connectionResult += "</responseBody> </idpResponse>\n";
            if(connectionResult.length() != 0){
                if(connectionResult.toString().indexOf("<cmd>") != -1){
                    cmd = connectionResult.toString().substring(connectionResult.toString().indexOf("<cmd>")+"<cmd>".length() , connectionResult.toString().indexOf("</cmd>"));
                }
                if(connectionResult.toString().indexOf("<result>") != -1){
                    result = connectionResult.toString().substring(connectionResult.toString().indexOf("<result>")+"<result>".length() , connectionResult.toString().indexOf("</result>"));
                }
                if(connectionResult.toString().indexOf("<result_text>") != -1){
                    result_text = connectionResult.toString().substring(connectionResult.toString().indexOf("<result_text>")+"<result_text>".length() , connectionResult.toString().indexOf("</result_text>"));
                }
                if(connectionResult.toString().indexOf("<option value=\"hanja\">") != -1){
                    System.out.println("connectionResult.length() == ["+connectionResult.length()+"]");
                    System.out.println("index testString == ["+connectionResult.toString().indexOf("<option value=\"hanja\">"));
                    join_type = connectionResult.toString().substring(connectionResult.toString().indexOf("<option value=\"hanja\">")+"<option value=\"hanja\">".length() , connectionResult.toString().indexOf("<option value=\"hanja\">"));
                }
            }            
        }catch(MalformedURLException mue){
            System.err.println("잘못되 URL입니다. 사용법 : java URLConn http://hostname/path]");
            result = "-1";
        }catch(Exception e){
            System.err.println("=================== IPD ADAPTER ERROR ====================");
            OmpLogger.error(e.getMessage(), e);
            result = "-1";
        }
        
        resultMap.put("cmd", cmd);
        resultMap.put("result", result);
        resultMap.put("result_text", result_text);
        resultMap.put("join_type", join_type);
        System.out.println("join_type == ["+join_type+"]");
     
        return resultMap;
    }
    
    
    //************************* 유선 서비스 API ***********************************//
    
    /** --------------------------------------------------------------------------
     * @method : aleadyJoinCheck
     * @author : KIM JI HUN 
     * @description : 서비스 중복 가입 CHECK
     * @date : 2009.04.20 
     * @param : key_type,key
     * @requestURL : http://baseurl/web/Join.api
     * @requestParam : cmd=aleadyJoinCheck&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&key_type =1&key=gil@nate.com
     * @resultParam : cmd,result,result_text,join_type
    -------------------------------------------------------------------------- **/  
    public HashMap aleadyJoinCheck(String key_type,String key){
        
        URL url;//URL 주소 객체
        URLConnection connection;//URL접속을 가지는 객체
        InputStream is;//URL접속에서 내용을 읽기위한 Stream
        InputStreamReader isr;
        BufferedReader br;
        
        //REQUEST PARAMETER VALUE
        String requestParam = "";
        
        //RESULT VALUE
        String connectionResult = "";
        
        HashMap resultMap = new HashMap();
        
        CryptoUtil crypto = new CryptoUtil();
        String spAuthKey = "";
        spAuthKey= crypto.getSpAuthKey();
        
        try{
            requestParam = "?cmd=aleadyJoinCheck";
            requestParam += "&sp_id="+spId;
            requestParam += "&sp_auth_key="+spAuthKey;
            requestParam += "&resp_flow=resp";
            requestParam += "&resp_type=2";         //1:name=value  2:XML
            requestParam += "&key_type="+key_type;   //1:email  2:주민번호
            requestParam += "&key="+key;
    //      requestParam += "&resp_url=";           //resp_flow가 redt 일때 response URL
            
            System.out.println("requestParam == ["+requestParam+"]");
            //URL객체를 생성하고 해당 URL로 접속한다..
            url = new URL("http://"+baseURL+"/web/Join.api"+requestParam);
            connection = url.openConnection();
            
            //내용을 읽어오기위한 InputStream객체를 생성한다..
            is = connection.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);

            //내용을 읽어서 화면에 출력한다..
            String buf = null;
            while(true){
                buf = br.readLine();
                if(buf == null) break;
                System.out.println(buf);
                connectionResult += buf.toString();
            } 
            
            // XML 파싱
            if(connectionResult.length() != 0){
                SAXBuilder builder = new SAXBuilder();
                Document doc = builder.build(new StringReader(connectionResult));
                
                resultMap = executeParse(doc);
            }
            
            
        }catch(MalformedURLException mue){
            System.err.println("잘못되 URL입니다. 사용법 : java URLConn http://hostname/path]");
        }catch(JDOMException je){
            System.err.println("=========== XML PARSER ERROR =============");
        }catch(Exception e){
            System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
            OmpLogger.error(e.getMessage(), e);
        }
     
        return resultMap;
    }    
    
    
    /** --------------------------------------------------------------------------
     * @method : duplicateIDCheck
     * @author : KIM JI HUN 
     * @description : ID 중복 CHECK
     * @date : 2009.04.20 
     * @param : userID
     * @requestURL : http://baseurl/web/Join.api
     * @requestParam : cmd=duplicateIDCheck&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&user_id=kildong
     * @resultParam : cmd,result,result_text
    -------------------------------------------------------------------------- **/  
    
   public HashMap duplicateIDCheck(String userID){
        
        URL url;//URL 주소 객체
        URLConnection connection;//URL접속을 가지는 객체
        InputStream is;//URL접속에서 내용을 읽기위한 Stream
        InputStreamReader isr;
        BufferedReader br;
        
        String requestParam = "";
        String connectionResult = "";

        HashMap<String, String> resultMap = null;

        CryptoUtil crypto = new CryptoUtil();
        
        String spAuthKey = "";
        spAuthKey= crypto.getSpAuthKey();
        
        try{
            requestParam = "?cmd=duplicateIDCheck";
            requestParam += "&sp_id="+spId;
            requestParam += "&sp_auth_key="+spAuthKey;
            requestParam += "&resp_type=2";
            requestParam += "&resp_flow=resp";
//            requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
            requestParam += "&user_id="+userID;
        
            //URL객체를 생성하고 해당 URL로 접속한다..
            url = new URL("http://"+baseURL+"/web/Join.api"+requestParam);
            connection = url.openConnection();        
            
            //내용을 읽어오기위한 InputStream객체를 생성한다..
            is = connection.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);

            //내용을 읽어서 화면에 출력한다..
            String buf = null;
            while(true){
                buf = br.readLine();
                if(buf == null) break;
                System.out.println(buf);
                connectionResult += buf.toString();
            } 
            
            // XML 파싱
            if(connectionResult.length() != 0){
                SAXBuilder builder = new SAXBuilder();
                Document doc = builder.build(new StringReader(connectionResult));
                
                resultMap = executeParse(doc);
            }
            
        }catch(MalformedURLException mue){
            System.err.println("잘못되 URL입니다. 사용법 : java URLConn http://hostname/path]");
        }catch(JDOMException je){
            System.err.println("=========== XML PARSER ERROR =============");
        }catch(Exception e){
            System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
            OmpLogger.error(e.getMessage(), e);
        }
     
        return resultMap;
    }  

    
   /** --------------------------------------------------------------------------
    * @method : realNameAuth
    * @author : KIM JI HUN 
    * @description : 주민등록번호(외국인 등록번호) 실명인증
    * @date : 2009.04.20 
    * @param : type,user_name,user_social_number
    * @requestURL : http://baseurl/web/RealNameAuth.api
    * @requestParam : cmd=realNameAuth&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&type=1&user_name=홍길동&user_social_number=xxx
    * @resultParam : cmd,result,result_text
   -------------------------------------------------------------------------- **/  
   
  public HashMap realNameAuth(String type,String user_name,String user_social_number){
       
       URL url;//URL 주소 객체
       URLConnection connection;//URL접속을 가지는 객체
       InputStream is;//URL접속에서 내용을 읽기위한 Stream
       InputStreamReader isr;
       BufferedReader br;
       
       String requestParam = "";
       String connectionResult = "";
       
       HashMap resultMap = new HashMap();
       
       CryptoUtil crypto = new CryptoUtil();
       String spAuthKey = "";
       spAuthKey= crypto.getSpAuthKey();
       
       try{
           requestParam = "?cmd=realNameAuth";
           requestParam += "&sp_id="+spId;
           requestParam += "&sp_auth_key="+spAuthKey;
           requestParam += "&resp_type=2";
           requestParam += "&resp_flow=resp";
   //      requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
           requestParam += "&type="+type;       //1:내국인  2:국내거주외국인
           requestParam += "&user_name="+user_name;
           requestParam += "&user_social_number="+user_social_number;
       
           //URL객체를 생성하고 해당 URL로 접속한다..
           url = new URL("http://"+baseURL+"/web/RealNameAuth.api"+requestParam);
           connection = url.openConnection();
           
           //내용을 읽어오기위한 InputStream객체를 생성한다..
           is = connection.getInputStream();
           isr = new InputStreamReader(is);
           br = new BufferedReader(isr);

           //내용을 읽어서 화면에 출력한다..
           String buf = null;
           while(true){
               buf = br.readLine();
               if(buf == null) break;
               System.out.println(buf);
               connectionResult += buf.toString();
           } 

           // XML 파싱
           if(connectionResult.length() != 0){
               SAXBuilder builder = new SAXBuilder();
               Document doc = builder.build(new StringReader(connectionResult));
               
               resultMap = executeParse(doc);
           }
           
       }catch(MalformedURLException mue){
           System.err.println("잘못되 URL입니다. 사용법 : java URLConn http://hostname/path]");
       }catch(JDOMException je){
           System.err.println("=========== XML PARSER ERROR =============");
       }catch(Exception e){
           System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
           OmpLogger.error(e.getMessage(), e);
       }
    
       return resultMap;
   }      
    
    
  /** --------------------------------------------------------------------------
   * @method : authNateID
   * @author : KIM JI HUN 
   * @description : Nate ID 인증
   * @date : 2009.04.20 
   * @param : user_id,user_password
   * @requestURL : https://baseurl/web/AuthNateID.api
   * @requestParam : cmd=authNateID&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&resp_type=1&user_id =gil&user_passwd=gil123
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap authNateID(String user_id,String user_password){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=authNateID";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
        requestParam += "&resp_url=naver.com";       //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_passwd="+user_password;
          System.out.println("requestParam == ["+requestParam+"]");
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/AuthNateID.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못되 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
          OmpLogger.error(e.getMessage(), e);
      }

      return resultMap;
  }      
    
    
  /** --------------------------------------------------------------------------
   * @method : mobileAuthcodeSend
   * @author : KIM JI HUN 
   * @description : 휴대폰 인증코드 발송
   * @date : 2009.04.20 
   * @param : user_mdn,user_mdn_type,user_social_number
   * @requestURL : http://baseurl/web/mobileAuth.api
   * @requestParam : cmd=mobileAuth&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&resp_type=1&user_mdn=01012345678&user_auth_code=989898&mobile_sign=xxxx&sign_data=xxxx
   * @resultParam : cmd,result,result_text,mobile_sign,sign_data
  -------------------------------------------------------------------------- **/  
  public HashMap mobileAuthcodeSend(String user_mdn,String user_mdn_type,String user_social_number){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=mobileAuthcodeSend";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
          requestParam += "&user_mdn="+user_mdn;
          requestParam += "&user_mdn_type="+user_mdn_type;
          if(user_social_number != null && !user_social_number.equals("")){
              requestParam += "&user_social_number="+user_social_number;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER mobileAuthcodeSend Method ERROR ====================");
          OmpLogger.error(e.getMessage(), e);
      }

      return resultMap;
  }          
    
    
  /** --------------------------------------------------------------------------
   * @method : mobileAuth
   * @author : KIM JI HUN 
   * @description : 휴대폰 인증
   * @date : 2009.04.20 
   * @param : user_mdn,user_code,mobile_sign,sign_data
   * @requestURL : http://baseurl/web/mobileAuth.api
   * @requestParam : cmd=mobileAuth&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&resp_type=1&user_mdn=01012345678&user_auth_code=989898&mobile_sign=xxxx&sign_data=xxxx
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap mobileAuth(String user_mdn,String user_code,String mobile_sign,String sign_data,String svc_mng_num,String model_id){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=mobileAuth";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
          requestParam += "&user_mdn="+user_mdn;
          requestParam += "&user_code="+user_code;
          requestParam += "&mobile_sign="+mobile_sign;
          requestParam += "&sign_data="+sign_data;
          requestParam += "&svc_mng_num="+svc_mng_num;
          requestParam += "&model_id="+model_id;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
          OmpLogger.error(e.getMessage(), e);
      }

      return resultMap;
  }              
    
  /** --------------------------------------------------------------------------
   * @method : watermarkAuthimage
   * @author : KIM JI HUN 
   * @description : 워터마크 인증 Image 발급
   * @date : 2009.04.20 
   * @param :
   * @requestURL : http://baseurl/web/watermarkAuth.api
   * @requestParam : cmd=watermarkAuthimage&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap watermarkAuthImage(){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=watermarkAuthImage";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/WatermarkAuth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
       // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER watermarkAuthimage Method ERROR ====================");
          OmpLogger.error(e.getMessage(), e);
      }

      return resultMap;
  }     
    
    
  /** --------------------------------------------------------------------------
   * @method : watermarkAuth
   * @author : KIM JI HUN 
   * @description : 워터마크 인증
   * @date : 2009.04.20 
   * @param : user_code,image_url,image_sign,sign_data
   * @requestURL : http://baseurl/web/watermarkAuth.ap
   * @requestParam : cmd=watermarkAuth&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&user_code=ABCD2F&image_url=xxxx&image_sign=xxxxxx&sign_data=xxxx
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap watermarkAuth(String user_code,String image_url,String image_sign,String sign_data){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=watermarkAuth";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";       //resp_flow가 redt 일때 response URL
          requestParam += "&user_code="+user_code;
          requestParam += "&image_url="+image_url;
          requestParam += "&image_sign="+image_sign;
          requestParam += "&sign_data="+sign_data;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/watermarkAuth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }         
    

  /** --------------------------------------------------------------------------
   * @method : minTomdn
   * @author : KIM JI HUN 
   * @description : 워터마크 인증
   * @date : 2009.04.20 
   * @param :min
   * @requestURL : http://baseurl/web/join.api
   * @requestParam : cmd=minTomdn&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&min=01923112222
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap minTomdn(String min){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=minTomdn";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&min="+min;          //전화번호
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/watermarkAuth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }
    
    
  /** --------------------------------------------------------------------------
   * @method : minTomdn
   * @author : KIM JI HUN 
   * @description : 비실명 회원 가입 신청
   * @date : 2009.04.20 
   * @param :HashMap
   * @requestURL : https://baseurl/web/join.api
   * @requestParam : cmd=joinApplyForEmail&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&user_id=gil&user_passwd=gil123&user_email=xxx&user_national=xxx&user_phone=0112342341,01023499887
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap joinApplyForEmail(HashMap paramMap){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      
      String user_id = "";
      String user_passwd = "";
      String user_email = "";
      String user_job_code = "";
      String user_zipcode = "";
      String user_address = "";
      String user_sex = "";
      String user_birthday = "";
      String user_social_number = "";
      String user_name = "";
      String user_phone = "";
      String service_profile = "";
      String watermark_auth = "";           //워터마크 인증여부- 1:인증비포함 2:인증포함
      String image_sign = "";
      String image_data = "";
      
      String connectionResult = "";
      
      
      if(paramMap != null){
          user_id = (String)paramMap.get("user_id");
          user_passwd = (String)paramMap.get("user_passwd");
          user_email = (String)paramMap.get("user_email");
          user_job_code = (String)paramMap.get("user_job_code");
          user_zipcode = (String)paramMap.get("user_zipcode");
          user_address = (String)paramMap.get("user_address");
          user_sex = (String)paramMap.get("user_sex");
          user_birthday = (String)paramMap.get("user_birthday");
          user_social_number = (String)paramMap.get("user_social_number");
          user_name = (String)paramMap.get("user_name");
          user_phone = (String)paramMap.get("user_phone");
          service_profile = (String)paramMap.get("service_profile");
          watermark_auth = (String)paramMap.get("watermark_auth");
          image_sign = (String)paramMap.get("image_sign");
          image_data = (String)paramMap.get("image_data");
      }
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=joinApplyForEmail";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_passwd="+user_passwd;
          requestParam += "&user_email="+user_email;
          requestParam += "&user_job_code="+user_job_code;
          requestParam += "&user_zipcode="+user_zipcode;
          requestParam += "&user_address="+user_address;
          requestParam += "&user_sex="+user_sex;
          requestParam += "&user_birthday="+user_birthday;
          requestParam += "&user_social_number="+user_social_number;
          requestParam += "&user_name="+user_name;
          requestParam += "&user_phone="+user_phone;
          requestParam += "&service_profile="+service_profile;
          requestParam += "&watermark_auth="+watermark_auth;
          if(watermark_auth.equals("2")){
              requestParam += "&image_sign="+image_sign;
              requestParam += "&image_data="+image_data;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/join.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }    
  
  
  
  /** --------------------------------------------------------------------------
   * @method : joinApplyForSN
   * @author : KIM JI HUN 
   * @description : 14세 미만 실명 회원 가입 신청
   * @date : 2009.04.20 
   * @param : HashMap
   * @requestURL : /web/Join.api
   * @requestParam : cmd=joinApplyForSN&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&user_id=gil&user_passwd=gil123&user_email=xxx&user_job_codel=xxx&user_phone=0112342341|01023499887&image_sign=xxx&sign_data=xxxxx
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap joinApplyForSN(HashMap paramMap){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      
      String user_id = "";
      String user_passwd = "";
      String user_name = "";
      String user_social_number = "";
      String user_type = "";
      String is_parents = "";
      String parent_social_number = "";
      String parent_name = "";
      String parent_email = "";
      String parent_mdn = "";
      String user_sex = "";
      String user_job = "";
      String user_birthday = "";
      String user_zipcode = "";
      String user_address = "";
      String user_tel = "";
      String user_phone = "";
      String service_profile = "";
      String watermark_auth = "";
      String image_sign = "";
      String sign_data = "";
      
      String connectionResult = "";
      
      if(paramMap != null){
          user_id = (String)paramMap.get("user_id");
          user_passwd = (String)paramMap.get("user_passwd");
          user_name = (String)paramMap.get("user_name");
          user_social_number = (String)paramMap.get("user_social_number");
          user_type = (String)paramMap.get("user_type");
          is_parents = (String)paramMap.get("is_parents");
          parent_social_number = (String)paramMap.get("parent_social_number");
          parent_name = (String)paramMap.get("parent_name");
          parent_email = (String)paramMap.get("parent_email");
          parent_mdn = (String)paramMap.get("parent_mdn");
          user_sex = (String)paramMap.get("user_sex");
          user_job = (String)paramMap.get("user_job");
          user_birthday = (String)paramMap.get("user_birthday");
          user_zipcode = (String)paramMap.get("user_zipcode");
          user_address = (String)paramMap.get("user_address");
          user_tel = (String)paramMap.get("user_tel");
          user_phone = (String)paramMap.get("user_phone");
          service_profile = (String)paramMap.get("service_profile");
          watermark_auth = (String)paramMap.get("watermark_auth");
          image_sign = (String)paramMap.get("image_sign");
          sign_data = (String)paramMap.get("sign_data");
      }
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=joinApplyForSN";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_passwd="+user_passwd;
          requestParam += "&user_name="+user_name;
          requestParam += "&user_social_number="+user_social_number;
          requestParam += "&user_type="+user_type;
          requestParam += "&is_parents="+is_parents;
          requestParam += "&parent_social_number="+parent_social_number;
          requestParam += "&parent_name="+parent_name;
          requestParam += "&parent_email="+parent_email;
          requestParam += "&parent_mdn="+parent_mdn;
          requestParam += "&user_sex="+user_sex;
          requestParam += "&user_job="+user_job;
          requestParam += "&user_birthday="+user_birthday;
          requestParam += "&user_zipcode="+user_zipcode;
          requestParam += "&user_address="+user_address;
          requestParam += "&user_tel="+user_tel;
          requestParam += "&user_phone="+user_phone;
          requestParam += "&service_profile="+service_profile;
          requestParam += "&watermark_auth="+watermark_auth;
          if(watermark_auth.equals("2")){
              requestParam += "&image_sign="+image_sign;
              requestParam += "&sign_data="+sign_data;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/join.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }  
    

  
  /** --------------------------------------------------------------------------
   * @method : joinComplete
   * @author : KIM JI HUN 
   * @description : 회원 가입 승인
   * @date : 2009.04.20 
   * @param : userID
   * @requestURL : /web/Join.api
   * @requestParam : cmd=joinApplyForSN&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&user_id=gil&user_passwd=gil123&user_email=xxx&user_job_codel=xxx&user_phone=0112342341|01023499887&image_sign=xxx&sign_data=xxxxx
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap joinComplete(String user_id,String user_key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      String email_auth_link = "";
      
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=joinComplete";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_key="+user_key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/join.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          OmpLogger.error(e.getMessage(), e);
          System.err.println("=================== IPD ADAPTER joinComplete Method ERROR ====================");
      }

      return resultMap;
  }

    
  
  /** --------------------------------------------------------------------------
   * @method : joinComplete
   * @author : KIM JI HUN 
   * @description : 일반 실명 회원 가입 처리
   * @date : 2009.04.20 
   * @param : userID
   * @requestURL : http://baseurl/web/auth.api
   * @requestParam : cmd=joinRequest&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&user_id=gil&user_passwd=gil123&user_email=xxx&user_national=xxx&user_phone=0112342341,01023499887
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap joinRequest(HashMap paramMap){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      
      String user_id = "";
      String user_passwd = "";
      String user_name = "";
      String user_social_number = "";
      String user_type = "";
      String user_sex = "";
      String user_job= "";
      String user_birthday = "";
      String user_zipcode = "";
      String user_address = "";
      String user_tel = "";
      String user_phone = "";
      String service_profile = "";
      String watermark_auth = "";           //워터마크 인증여부- 1:인증비포함 2:인증포함
      String image_sign = "";
      String image_data = "";
      
      String connectionResult = "";
      
      
      if(paramMap != null){
          user_id = (String)paramMap.get("user_id");
          user_passwd = (String)paramMap.get("user_passwd");
          user_name = (String)paramMap.get("user_name");
          user_social_number = (String)paramMap.get("user_social_number");
          user_type = (String)paramMap.get("user_type");
          user_sex = (String)paramMap.get("user_sex");
          user_job = (String)paramMap.get("user_job");
          user_birthday = (String)paramMap.get("user_birthday");
          user_zipcode = (String)paramMap.get("user_zipcode");
          user_address = (String)paramMap.get("user_address");
          user_tel = (String)paramMap.get("user_tel");
          user_phone = (String)paramMap.get("user_phone");
          service_profile = (String)paramMap.get("service_profile");
          watermark_auth = (String)paramMap.get("watermark_auth");
          if(watermark_auth.equals("2")){
              image_sign = (String)paramMap.get("image_sign");
              image_data = (String)paramMap.get("image_data");
          }
      }
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=joinRequest";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&userID="+user_id;
          requestParam += "&user_passwd="+user_passwd;
          requestParam += "&user_name="+user_name;
          requestParam += "&user_social_number="+user_social_number;
          requestParam += "&user_type="+user_type;
          requestParam += "&user_sex="+user_sex;
          requestParam += "&user_job="+user_job;
          requestParam += "&user_birthday="+user_birthday;
          requestParam += "&user_zipcode="+user_zipcode;
          requestParam += "&user_address="+user_address;
          requestParam += "&user_tel="+user_tel;
          requestParam += "&user_phone="+user_phone;
          requestParam += "&service_profile="+service_profile;
          requestParam += "&watermark_auth="+watermark_auth;
          if(watermark_auth.equals("2")){
              requestParam += "&image_sign="+image_sign;
              requestParam += "&image_data="+image_data;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/join.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }

  
  /** --------------------------------------------------------------------------
   * @method : authForId
   * @author : KIM JI HUN 
   * @description : 유선회원의 ID 인증
   * @date : 2009.04.20 
   * @param : user_id,user_passwd
   * @requestURL : http://baseurl/web/Auth.api
   * @requestParam : cmd=authForId&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&user_id =gil&user_passwd=gil123
   * @resultParam : cmd,result,result_text,user_auth_key,sign_data,user_id,user_key
  -------------------------------------------------------------------------- **/  
  public HashMap authForId(String user_id,String user_passwd){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      
      String connectionResult = "";
      
  

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=authForId";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_passwd="+user_passwd;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }
  
  /** --------------------------------------------------------------------------
   * @method : authForPasswd
   * @author : KIM JI HUN 
   * @description : 유선회원의 PASSWORD 인증
   * @date : 2009.04.20 
   * @param : user_id,user_passwd
   * @requestURL : http://baseurl/web/Auth.api
   * @requestParam : cmd=authForPasswd&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&user_id =gil&user_passwd=gil123
   * @resultParam : cmd,result,result_text
  -------------------------------------------------------------------------- **/  
  public HashMap authForPasswd(String user_id,String user_passwd){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      String requestParam = "";
      
      String connectionResult = "";
      
  

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=authForPasswd";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_id="+user_id;
          requestParam += "&user_passwd="+user_passwd;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }  
  
  
    

  
  /** --------------------------------------------------------------------------
   * @method : authForMDN
   * @author : KIM JI HUN 
   * @description : 무선 전용회원 MDN 인증
   * @date : 2009.04.20 
   * @param : user_mdn,user_code,mobile_sign,sign_data
   * @requestURL : http://baseurl/web/Auth.api
   * @requestParam : cmd=authForMDN&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&resp_type=1&user_mdn=01012345678&user_code=989898&mobile_sign=xxxx&sign_data=xxxx
   * @resultParam : 
  -------------------------------------------------------------------------- **/  
  public HashMap authForMDN(String user_mdn,String user_code,String mobile_sign,String sign_data){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";      
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=authForMDN";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&user_mdn="+user_mdn;
          requestParam += "&user_code="+user_code;
          requestParam += "&mobile_sign="+mobile_sign;
          requestParam += "&sign_data="+sign_data;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }

      return resultMap;
  }    
    

  
  /** --------------------------------------------------------------------------
   * @method : findCommonProfile
   * @author : KIM JI HUN 
   * @description : 기본 Profile 조회
   * @date : 2009.04.20 
   * @param : key_type(1:id  2:Email  3:UserKey),key
   * @requestURL : http://baseurl/web/Search.api
   * @requestParam : cmd=findCommonProfile&sp_id=omp&sp_auth_key=xxxx&user_auth_key=xxxx&resp_flow=resp&resp_type=1&key_type=1&key=kildong
   * @resultParam : 
  -------------------------------------------------------------------------- **/  
  public HashMap findCommonProfile(String key_type,String key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";  
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=findCommonProfile";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Search.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      
      return resultMap;
  }    
  
  
  
  /** --------------------------------------------------------------------------
   * @method : findCommonProfileForServer
   * @author : KIM JI HUN 
   * @description : 기본 Profile 조회 (SP 직접 조회용 API)
   * @date : 2009.04.20 
   * @param : key_type(1:id  2:Email  3:UserKey),key
   * @requestURL : http://baseurl/web/Search.api
   * @requestParam : ?cmd=findCommonProfileForServer&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&key_type=1&key=kildong
   * @resultParam : 
  -------------------------------------------------------------------------- **/  
  public HashMap findCommonProfileForServer(String key_type,String key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";  
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=findCommonProfileForServer";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Search.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      
      return resultMap;
  }  
    
  
  /** --------------------------------------------------------------------------
   * @method : findSpecialProfile
   * @author : KIM JI HUN 
   * @description : 특정 Profile 조회
   * @date : 2009.04.20 
   * @param : key_type,key,req_profile_list(조회를 원하는 특정 Profile Field의 List)
   * @requestURL : http://baseurl/web/Search.api
   * @requestParam : cmd=findSpecialProfile&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&key_type=1&key=kildong&req_profile_list=email|user_address|user_zipcode
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap findSpecialProfile(String key_type,String key,String req_profile_list){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";  
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=findSpecialProfile";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          requestParam += "&req_profile_list="+req_profile_list;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/findSpecialProfile.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  }     
    
    
  /** --------------------------------------------------------------------------
   * @method : findID
   * @author : KIM JI HUN 
   * @description : ID 조회
   * @date : 2009.04.20 
   * @param : key_type(1:Email 2:주민번호 3:UserKey),key,watermark_auth(1:수동가입인증 2:비인증),   watermark_auth가 2일 경우(image_sign,sign_data)
   * @requestURL : https://baseurl/web/Search.api
   * @requestParam : cmd=findID&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&watermark_auth=2&key_type=1&key=gil@nate.com
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap findID(String key_type,String key,String watermark_auth,String user_code,String image_sign,String sign_data){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";  
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=findID";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          requestParam += "&watermark_auth="+watermark_auth;
          if(watermark_auth.equals("1")){
              requestParam += "&user_code="+user_code;
              requestParam += "&image_sign="+image_sign;
              requestParam += "&sign_data="+sign_data;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Search.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER findID Method ERROR ====================");
      }
      return resultMap;
  }         
    
    
  /** --------------------------------------------------------------------------
   * @method : findPasswd
   * @author : KIM JI HUN 
   * @description : 임시 password 발급
   * @date : 2009.04.20 
   * @param : 
   * @requestURL : https://baseurl/web/Search.api
   * @requestParam : cmd=findPasswd&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_type=1&watermark_auth=2&key_type =1&key=gil@nate.com
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap findPasswd(String key_type,String key,String watermark_auth,String user_code,String image_sign,String sign_data){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";  
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=findPasswd";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          requestParam += "&watermark_auth="+watermark_auth;
          if(watermark_auth.equals("1")){
              requestParam += "&user_code="+user_code;
              requestParam += "&image_sign="+image_sign;
              requestParam += "&sign_data="+sign_data;
          }
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Search.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  }
    

  
  /** --------------------------------------------------------------------------
   * @method : modifyAuthInfo ---------> REDIRECT로!!
   * @author : KIM JI HUN 
   * @description : 비실명 회원 인증정보 변경
   * @date : 2009.04.20 
   * @param : key_type(1:Email 2:PASSWORD),key
   * @requestURL : https://baseurl/web/Modify.api
   * @requestParam : cmd=modifyAuthInfo&sp_id=omp&sp_auth_key=xxxx&resp_flow=redt&resp_url=http://sp.com/modify.jsp&resp_type=2&key_type =1&key=gil@nate.com
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap modifyAuthInfo(String user_auth_key,String key_type,String key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";
      
      //RESULT VALUE
      String connectionResult = "";
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=modifyAuthInfo";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&user_auth_key="+user_auth_key;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Modify.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER modifyAuthInfo Method ERROR ====================");
      }
      return resultMap;
  }
    

  /** --------------------------------------------------------------------------
   * @method : modifyProfile
   * @author : KIM JI HUN 
   * @description : 기본 정보 변경
   * @date : 2009.04.20 
   * @param : 
   * @requestURL : https://baseurl/web/Modify.api
   * @requestParam : cmd=modifyProfile&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=http://sp.com/modify.jsp&resp_type=1&key_type=1&key=gil&user_job_code=xxx&user_phone=0112342341|01023499887
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap modifyProfile(HashMap paramMap){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";

      String key_type = "";
      String key = "";
      String user_auth_key="";
      String user_job_code = "";
      String user_zipcode = "";
      String user_address = "";
      String user_sex = "";
      String user_birthday = "";
      String user_social_number = "";
      String user_name = "";
      String user_phone = "";
      String service_profile = "";
      String user_calendar = "";
      String user_tel = "";
      String user_type = "";
      String is_foreign = "";
      String user_nation = "";
      String is_rname_auth = "";
      
      //RESULT VALUE
      String connectionResult = "";
      
      if(paramMap != null){
          key_type = (String)paramMap.get("key_type");
          key = (String)paramMap.get("key");
          user_auth_key = (String)paramMap.get("user_auth_key");
          user_job_code = (String)paramMap.get("user_job_code");
          user_zipcode = (String)paramMap.get("user_zipcode");
          user_address = (String)paramMap.get("user_address");
          user_sex = (String)paramMap.get("user_sex");
          user_birthday = (String)paramMap.get("user_birthday");
          user_social_number = (String)paramMap.get("user_social_number");
          user_name = (String)paramMap.get("user_name");
          user_phone = (String)paramMap.get("user_phone");
          service_profile = (String)paramMap.get("service_profile");
          user_calendar = (String)paramMap.get("user_calendar");
          user_tel = (String)paramMap.get("user_tel");
          user_type = (String)paramMap.get("user_type");
          is_foreign = (String)paramMap.get("is_foreign");
          user_nation = (String)paramMap.get("user_nation");
          is_rname_auth = (String)paramMap.get("is_rname_auth");
      }

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=modifyProfile";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&user_auth_key="+user_auth_key;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          if(user_job_code != null){
              requestParam += "&user_job_code="+user_job_code;
          }
          if(user_zipcode != null){
              requestParam += "&user_zipcode="+user_zipcode;
          }
          if(user_address != null){
              requestParam += "&user_address="+user_address;
          }
          if(user_sex != null){
              requestParam += "&user_sex="+user_sex;
          }
          if(user_birthday != null){
              requestParam += "&user_birthday="+user_birthday;
          }
          if(user_social_number != null){
              requestParam += "&user_social_number="+user_social_number;
          }
          if(user_name != null){
              requestParam += "&user_name="+user_name;
          }
          if(user_phone != null){
              requestParam += "&user_phone="+user_phone;
          }
          if(service_profile != null){
              requestParam += "&service_profile="+service_profile;
          }
          if(user_calendar != null){
              requestParam += "&user_calendar="+user_calendar;
          }
          if(user_tel != null){
              requestParam += "&user_tel="+user_tel;
          }
          if(user_type != null){
              requestParam += "&user_type="+user_type;
          }
          if(is_foreign != null){
              requestParam += "&is_foreign="+is_foreign;
          }
          if(user_nation != null){
              requestParam += "&user_nation="+user_nation;
          }
          if(is_rname_auth != null){
              requestParam += "&is_rname_auth="+is_rname_auth;
          }
          
          
//          URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Modify.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER modifyProfile Method ERROR ====================");
      }
      return resultMap;
  }
    
    
  /** --------------------------------------------------------------------------
   * @method : secedeUser
   * @author : KIM JI HUN 
   * @description : 유선 회원 해지
   * @date : 2009.04.20 
   * @param : key_type: 1=ID, 2=User_Key  key:탈퇴할 key값 
   * @requestURL : https://baseurl/web/Scede.api
   * @requestParam : cmd=secedeUser&sp_id=omp&sp_auth_key=xxxx&user_auth=xxx&resp_flow=resp&resp_type=1&key_type=1&key=gil
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap secedeUser(String user_auth_key,String key_type,String key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=secedeUser";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&user_auth_key="+user_auth_key;
          requestParam += "&resp_type=2";
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Secede.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  }
  
    
  /** --------------------------------------------------------------------------
   * @method : contractForWap
   * @author : KIM JI HUN 
   * @description : 회원 가입
   * @date : 2009.04.20 
   * @param : proc_type(가입 처리와 동시에 인증 처리 요청 여부- joinOnly:가입만 처리   joinAuth:가입&인증처리)
   * @requestURL : http://baseurl/wap/Join.api
   * @requestParam : cmd=contractForWap&sp_id=omp&sp_auth_key=xxxx&resp_flow=redt&resp_url=http://sp.com&proc_type=joinAuth
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap contractForWap(String proc_type){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=contractForWap";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&proc_type="+proc_type;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Join.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  }    
    
    
  /** --------------------------------------------------------------------------
   * @method : mdnAuthForWap
   * @author : KIM JI HUN 
   * @description : 무선 회원 인증
   * @date : 2009.04.20 
   * @param : proc_type(가입 처리와 동시에 인증 처리 요청 여부- joinOnly:가입만 처리   joinAuth:가입&인증처리)
   * @requestURL : http://baseurl/wap/Auth.api
   * @requestParam : cmd=mdnAuthForWap&sp_id=omp&sp_auth_key=xxxx&resp_flow=redt&resp_url=xxx
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap mdnAuthForWap(){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";
      
      //RESULT VALUE
      String connectionResult = "";

      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=contractForWap";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Auth.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  }       
    
    
  /** --------------------------------------------------------------------------
   * @method : secedeForWap
   * @author : KIM JI HUN 
   * @description : 회원 Profile 조회
   * @date : 2009.04.20 
   * @param : 
   * @requestURL : http://baseurl/wap/Search.api
   * @requestParam : cmd=secedeForWap&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&key_type=1&key=01022332211
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
  public HashMap secedeForWap(String key_type,String key){
      
      URL url;//URL 주소 객체
      URLConnection connection;//URL접속을 가지는 객체
      InputStream is;//URL접속에서 내용을 읽기위한 Stream
      InputStreamReader isr;
      BufferedReader br;
      
      //REQUEST PARAMETER VALUE
      String requestParam = "";
      
      //RESULT VALUE
      String connectionResult = "";
      
      HashMap resultMap = new HashMap();
      
      CryptoUtil crypto = new CryptoUtil();
      String spAuthKey = "";
      spAuthKey= crypto.getSpAuthKey();
      
      try{
          requestParam = "?cmd=secedeForWap";
          requestParam += "&sp_id="+spId;
          requestParam += "&sp_auth_key="+spAuthKey;
          requestParam += "&resp_flow=resp";
  //      requestParam += "&resp_url=";         //resp_flow가 redt 일때 response URL
          requestParam += "&key_type="+key_type;
          requestParam += "&key="+key;
          
          //URL객체를 생성하고 해당 URL로 접속한다..
          url = new URL("http://"+baseURL+"/web/Search.api"+requestParam);
          connection = url.openConnection();
          
          //내용을 읽어오기위한 InputStream객체를 생성한다..
          is = connection.getInputStream();
          isr = new InputStreamReader(is);
          br = new BufferedReader(isr);

          //내용을 읽어서 화면에 출력한다..
          String buf = null;
          while(true){
              buf = br.readLine();
              if(buf == null) break;
              System.out.println(buf);
              connectionResult += buf.toString();
          } 
          
          // XML 파싱
          if(connectionResult.length() != 0){
              SAXBuilder builder = new SAXBuilder();
              Document doc = builder.build(new StringReader(connectionResult));
              
              resultMap = executeParse(doc);
          }
          
      }catch(MalformedURLException mue){
          System.err.println("잘못된 URL입니다. 사용법 : java URLConn http://hostname/path]");
      }catch(JDOMException je){
          System.err.println("=========== XML PARSER ERROR =============");
      }catch(Exception e){
          System.err.println("=================== IPD ADAPTER duplicateIDCheck Method ERROR ====================");
      }
      return resultMap;
  } 
    
    
  /** --------------------------------------------------------------------------
   * @method : findSpecialProfile
   * @author : KIM JI HUN 
   * @description : 회원 특정 Profile 조회
   * @date : 2009.04.20 
   * @param : 
   * @requestURL : http://baseurl/web/Search.api
   * @requestParam : cmd=findSpecialProfile&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&key_type=1&key=0112122333&req_profile_list=nickname|user_id
   * @resultParam : 
  -------------------------------------------------------------------------- **/    
    
    
  /** --------------------------------------------------------------------------
   * @method : secedeForWap
   * @author : KIM JI HUN 
   * @description : 회원 해지
   * @date : 2009.04.20 
   * @param : 
   * @requestURL : http://baseurl/web/secede.api
   * @requestParam : cmd=secedeForWap&sp_id=omp&sp_auth_key=xxxx&resp_flow=resp&resp_url=&key_type=1&key=0112122333&req_profile_list=nickname|user_id
   * @resultParam : 
  -------------------------------------------------------------------------- **/  
  
    
}